<?php

/**
 * This file is part of ossecdb-extjs.
 * 
 * Copyright (C) 2011 Brendan Johnston
 * 
 * Contact: brendan@johnston.net.au
 * 
 * Project: http://code.google.com/p/ossecdb-extjs/
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

require('_inc/_all.php');

$OssecWebConfig = (object) array(
	'paths' => (object) array(
		'extjs' => $config['extjs_path']
	),
	'format' => (object) array(
		'dateFormat' => $config['extjs_date_format']
	)
);

if ($config['geolocation_enabled'])
{
	$OssecWebConfig->geolocation = (object) array(
		'enabled' => true,
		'countryCodes' => $config['geolocation_country_codes']
	);
}
else
{
	$OssecWebConfig->geolocation = (object) array(
		'enabled' => false
	);
}

header('Content-type: text/javascript');
echo 'var OssecWebConfig = ' . json_encode($OssecWebConfig) . ';';